<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>博客</title>
    <link rel="stylesheet" href="/public/css/main.css">
    <link rel="stylesheet" href="/public/fontAwesome/css/font-awesome.min.css">
    <script src="/public/js/jquery-1.12.4.min.js"></script>
    <script src="/public/js/index.js"></script>
</head>
<body>
<header>
    <div class="backimg"><img src="/public/images/IMG_0292.jpg"></div>

</header>

<nav>
    <div class="menu">
        {% if category ==''%}
        <a href="/" class="focus">首页</a>
        {% else %}
        <a href="/">首页</a>
        {% endif %}
        {% for cate in categories%}
        {% if category ==cate.id %}
        <a href="/?category={{cate.id}}" class="focus">{{cate.name}}</a>
        {% else %}
        <a href="/?category={{cate.id}}" >{{cate.name}}</a>
        {% endif %}
        {% endfor %}
    </div>
</nav>

<main class="clear">
    <div class="mainLeft">

        {% block content %}
        {% endblock %}
    </div>

    <div class="mainRight">

        {% if userInfo._id %}
        <div class="rightBox" id="userInfo">
            <div class="title"><span>用户信息</span></div>
            <p><span class="colDark ">{{userInfo.username}}</span></p>
            {% if userInfo.isAdmin %}
            <p>
                <span class="colDanger">你好，管理员！
                    <a href="/admin">进入管理</a>
                </span>
            </p>
            {% else %}
            <p><span class="colDanger">你好，欢迎光临我的博客！</span></p>
            {% endif %}
            <p><span class="colDark "><a href="javascript:;"  id="logout">退出</a></span></p>
        </div>
        {% else %}
        <div class="rightBox" id="loginBox" >
            <div class="title"><span>登录</span></div>
            <div class="line"><span class="colDark">用户名：</span><input type="text" name="username" /><em></em></div>
            <div class="line"><span class="colDark">密码：</span><input type="password" name="password"><em></em></div>
            <div class="line"><span class="colDark"></span>
                <button>登 录</button>
            </div>
            <p class="textRight">还没注册？<a href="javascript:;" class="colMint">马上注册</a></p>
            <p class="colWarning textCenter"></p>
        </div>

        <div class="rightBox"id="registerBox"style="display: none;">
            <div class="title"><span>注册</span></div>
            <div class="line"><span class="colDark">用户名：</span><input type="text" name="username"></div>
            <div class="line"><span class="colDark">密码：</span><input type="password" name="password"></div>
            <div class="line"><span class="colDark">确认：</span><input type="password" name="repassword"></div>
            <div class="line"><span class="colDark"></span>
                <button>注 册</button>
            </div>
            <p class="textRight">已有账号？<a href="javascript:;" class="colMint">马上登录</a></p>
            <p class="colWarning textCenter"></p>
        </div>
        {% endif %}
        <div class="rightBox">
            <div class="title"><span>社区</span></div>
            <p><a href="https://www.w3cvip.org/topics" class="colDanger" target="_blank">w3cvip</a></p>
            <p><a href="http://www.html-js.com/" class="colDanger" target="_blank">前端乱炖</a></p>
        </div>

    </div>

</main>

<div class="copyright textCenter">Copyright 版权所有，翻版必究</div>

</body>
</html>